<?php
session_start();
if (isset($_SESSION['msgAlert'])){
	$msgAlert = $_SESSION['msgAlert'];
	unset($_SESSION['msgAlert']);
}

$articuloId        = $ArticuloFrm->articuloId;
$tipoArticulo      = $ArticuloFrm->tipo;
$descripcion       = $ArticuloFrm->descripcion;  
$memo              = $ArticuloFrm->memo;  
$alias             = $ArticuloFrm->alias;   
$codFabricante     = $ArticuloFrm->codFabricante;   
$clasificId        = $ArticuloFrm->clasificId;   
$subClasificId     = $ArticuloFrm->subClasificId;   
$marcaId           = $ArticuloFrm->marcaId;   
$undMedida	   = $ArticuloFrm->undMedida;   
$undMedidaCompra   = $ArticuloFrm->undMedidaCompra;   
$undMedidaVenta    = $ArticuloFrm->undMedidaVenta;   
$undMedidaCompraFactor   = $ArticuloFrm->undMedidaCompraFactor;   
$undMedidaVentaFactor    = $ArticuloFrm->undMedidaVentaFactor;   
$garantia          = $ArticuloFrm->garantia;  
$inventariable     = $ArticuloFrm->inventariable;   
$ctrlSeries        = $ArticuloFrm->ctrlSeries;   
$paraCompra        = $ArticuloFrm->paraCompra;   
$paraVenta         = $ArticuloFrm->paraVenta;   
$afectoImp1        = $ArticuloFrm->afectoImp1;   
$afectoImp2        = $ArticuloFrm->afectoImp2;   
$afectoImp3        = $ArticuloFrm->afectoImp3;   
$advporc           = $ArticuloFrm->advporc;   
$peso              = $ArticuloFrm->peso;   
$volumen           = $ArticuloFrm->volumen;   
$precioLista       = $ArticuloFrm->precioLista;   
$costoProm         = $ArticuloFrm->costoProm;   
$costoUlt          = $ArticuloFrm->costoUlt;   
$stockMin          = $ArticuloFrm->stockMin;   
$stockMax          = $ArticuloFrm->stockMax;   
$tiempoReposic     = $ArticuloFrm->tiempoReposic;   
$activo            = $ArticuloFrm->activo;   
$creaUsr           = $ArticuloFrm->creaUsr;   
$creaFecha         = $ArticuloFrm->creaFecha;   
$modifUsr          = $ArticuloFrm->modifUsr;   
$modifFecha        = $ArticuloFrm->modifFecha;  
$a_tipoArticulo    = $ArticuloFrm->listaTipoArticulo;   
$a_undMedArticulo  = $ArticuloFrm->listaUndMedArticulo;   
$a_undMedCompra	   = $ArticuloFrm->listaUndMedCompra;   
$a_undMedVenta	   = $ArticuloFrm->listaUndMedVenta;   
$a_artClasificacion= $ArticuloFrm->listaClasificacion;  
$a_marca           = $ArticuloFrm->listaMarca;  

if ($peso == 0){
    $peso = '';
}
if ($precioLista == 0){
    $precioLista = '';
}

if ($stockMin == 0){
    $stockMin = '';
}
if ($stockMax == 0){
    $stockMax = '';
}

if ($tiempoReposic == 0){
    $tiempoReposic = '';
}

if ($tiempoReposic == 0){
    $tiempoReposic = '';
}

$contextMenu[0]["link"]      = "javascript:fn_ArNuevo()";
$contextMenu[0]["linkIcon"]  = "application_add.png";
$contextMenu[0]["linkTitle"] = "Nuevo articulo";

$contextMenu[1]["link"]      = "javascript:listarArticulos()";
$contextMenu[1]["linkIcon"]  = "application_view_list.png";
$contextMenu[1]["linkTitle"] = "Lista";
if ($articuloId){
    $contextMenu[2]["link"]      = "javascript:fn_ArDelete('".$articuloId."')";
    $contextMenu[2]["linkIcon"]  = "page_white_delete.png";
    $contextMenu[2]["linkTitle"] = "Eliminar articulo";
}
/*
$contextMenu[2]["link"]      = "?do=Articulo&accion=eliminarArticulo&articuloId=".$articuloId;
$contextMenu[2]["linkIcon"]  = "page_white_delete.png";
$contextMenu[2]["linkTitle"] = "Eliminar articulo";
*/

?>



<body>

<div id="main">
  <?php include $_SERVER['DOCUMENT_ROOT'].'/gourmet-express/trunk/src/views/header.inc'; ?>
  <div id="zonaContenedor">
    <h3>.:: Articulo </h3>
    <div id="module">          
      <div>
	<form id='frmArticulo'>
		<table id="form" width="100%">	     
            <tr>
                <td id="keyLabel">Codigo</td>
                <td>                    
                    <INPUT TYPE="text" NAME="articuloId" value="<?php echo $articuloId;?>"/>
                </td>
                <td id="label">Activo</td>
                <td>
                    <input type="checkbox" name="activo" id="activo" value="Y" <?php if ($activo=='Y'){echo " CHECKED ";}?>/>
                </td>
            </tr>
            <tr>
                <td id="label">Descripcion</td>
				<td><input type="text" name="descripcion" value="<?php echo $descripcion;?>" size="40" maxlenght="50"/></td>
				<td id="label">Para Compra</td>
				<td>
                    <input type="checkbox" name="paraCompra" id="paraCompra" value="Y" <?php if ($paraCompra=='Y'){echo " CHECKED ";}?>/>
                </td>
	    	</tr>                         
 			<tr>
                <td id="label">Alias</td>
				<td><input type="text" name="alias" value="<?php echo $alias;?>" size="40" maxlenght="50"/></td>
				<td id="label">Para Venta</td>
				<td>
                    <input type="checkbox" name="paraVenta" id="paraVenta" value="Y" <?php if ($paraVenta=='Y'){echo " CHECKED ";}?>/>
                </td>
	    	</tr>             
            <tr>
                <td id="label">Cod Fabricante</td>
				<td><input type="text" name="codFabricante" value="<?php echo $codFabricante;?>" size="20" maxlenght="20"/></td>
				<td id="label">Inventariable</td>
				<td>
                    <input type="checkbox" name="inventariable" id="inventariable" value="Y" <?php if ($inventariable=='Y'){echo " CHECKED ";}?>/>
                </td>
	    	</tr>             
            <tr>
                <td id="label">Tipo</td>
				<td>
					<select name="tipoArticulo" id="tipoArticulo">
		  				<option></option>
		    			<?php 
							foreach ($a_tipoArticulo as $valor) {
								?>
								<option <?php if ($valor->getValorId() == $tipoArticulo){echo "SELECTED";}?> value="<?php echo $valor->getValorId()?>"><?php echo $valor->getDescripcion()?></option>
								<?php
							}
						?>		    
					</select>                    
                </td>
				<td id="label">Ctrl por Series</td>
				<td>
                    <input type="checkbox" name="ctrlSeries" id="ctrlSeries" value="Y" <?php if ($ctrlSeries=='Y'){echo " CHECKED ";}?>/>
                </td>
	    	</tr>             
            <tr>
                <td id="label">Clasificaci&oacute;n</td>
		<td>
                  <select name="clasificId" id="clasificId">
			<option></option>
		    	<?php 
			foreach ($a_artClasificacion as $valor) {
			?>
				<option <?php if ($valor->getClasificId() == $clasificId){echo "SELECTED";}?> value="<?php echo $valor->getClasificId()?>"><?php echo $valor->getDescripcion()?></option>
			<?php
			}
			?>				  						    		
		  </select></td>
		<td id="label">Afecto a Impuesto Vtas</td>
		<td>
                   <input type="checkbox" name="afectoImp1" id="afectoImp1" value="Y" <?php if ($afectoImp1=='Y'){echo " CHECKED ";}?>/>
                </td>
	    </tr>             
            <tr>
                <td id="label">Subclasificaci&oacute;n</td>
		<td>
                    <select name="subClasificId" id="subClasificId">
		  	<option></option>
		    	<?php 
			foreach ($a_artClasificacion as $valor) {
			?>
				<option <?php if ($valor->getClasificId() == $clasificId){echo "SELECTED";}?> value="<?php echo $valor->getClasificId()?>"><?php echo $valor->getDescripcion()?></option>
			<?php
			}
			?>			  					    
		    </select>
		</td>
		<td id="label">UoM </td>
		<td>
                  <select name="undMedida" id="undMedida">
                        <option></option>
		    	<?php 
			foreach ($a_undMedArticulo as $valor) {
			?>
				<option <?php if ($valor->getValorId() == $undMedida){echo "SELECTED";}?> value="<?php echo $valor->getValorId()?>"><?php echo $valor->getDescripcion()?></option>
			<?php
			}
			?>
                    </select>  
      		</td>
	    </tr>             
            <tr>
                <td id="label">Fabricante</td>
		<td>
                    <select name="marcaId" id="marcaId">
                        <option></option>
		    	<?php 
			foreach ($a_marca as $valor) {
			?>
				<option <?php if ($valor->getFabricanteId() == $marcaId){echo "SELECTED";}?> value="<?php echo $valor->getFabricanteId()?>"><?php echo $valor->getNombre()?></option>
			<?php
			}
			?>  		  					    		
                    </select>
		</td>
		<td id="label">UoM Compra</td>
		<td>
                    <select name="undMedidaCompra" id="undMedidaCompra">
                        <option></option>
			<?php 
			foreach ($a_undMedCompra as $valor) {
			?>
				<option <?php if ($valor->getValorId() == $undMedidaCompra){echo "SELECTED";}?> value="<?php echo $valor->getValorId()?>"><?php echo $valor->getDescripcion()?></option>
			<?php
			}
			?>                        
                    </select>  
                    Factor
                    <input type="text" name="undMedidaCompraFactor" id="undMedidaCompraFactor" value="<?php echo $undMedidaCompraFactor?>" size="5">
                </td>
	    	</tr>             
            <tr>
                <td id="label">Garantia</td>
		<td><INPUT TYPE="text" NAME="garantia" value="<?php echo $garantia;?>" size="10" maxlenght="10"/> meses</td>
		<td id="label">UoM Venta</td>
		<td>                    
                    <select name="undMedidaVenta" id="undMedidaVenta">
                        <option></option>
		    	<?php 
			foreach ($a_undMedVenta as $valor) {
			?>
				<option <?php if ($valor->getValorId() == $undMedidaVenta){echo "SELECTED";}?> value="<?php echo $valor->getValorId()?>"><?php echo $valor->getDescripcion()?></option>
			<?php
			}
			?>                        
                    </select>
                    Factor
                    <input type="text" name="undMedidaVentaFactor" id="undMedidaVentaFactor" value="<?php echo $undMedidaVentaFactor?>" size="5">                                                        
                </td>
	    </tr>             
            
            
            <tr>
                <td id="label">Precio de venta</td>
				<td>
                    <INPUT TYPE="text" NAME="precioLista" value="<?php echo $precioLista;?>" size="10" maxlenght="10"/>                    
                </td>
				<td id="label">Peso</td>
				<td>
                   <INPUT TYPE="text" NAME="peso" value="<?php echo $peso;?>" size="10" maxlenght="10"/>    Kg.   
                </td>
	    	</tr>   
            <tr>
                <td id="label">Stock Min</td>
				<td>
                    <INPUT TYPE="text" NAME="stockMin" value="<?php echo $stockMin;?>" size="10" maxlenght="10"/> UoM      
                </td>
				<td id="label">Volumen</td>
				<td>
                    <INPUT TYPE="text" NAME="volumen" value="<?php echo $volumen;?>" size="10" maxlenght="10"/>  m3.
                </td>
	    	</tr>               
            <tr>
                <td id="label">Stock Max</td>
				<td>
                    <INPUT TYPE="text" NAME="stockMax" value="<?php echo $stockMax;?>" size="10" maxlenght="10"/> UoM 
                </td>
				<td id="label">Costo Prom</td>
				<td>
                    <INPUT TYPE="text" NAME="costoProm" value="<?php echo $costoProm;?>" size="10" maxlenght="10"/>  
                </td>
	    	</tr>     
            <tr>
                <td id="label">Tiempo Reposicion</td>
				<td>
                    <INPUT TYPE="text" NAME="tiempoReposic" value="<?php echo $tiempoReposic;?>" size="10" maxlenght="10"/> dias
                </td>
				<td id="label">Costo Ult</td>
				<td>
                	<INPUT TYPE="text" NAME="costoUlt" value="<?php echo $costoUlt;?>" size="10" maxlenght="10"/>  
	    	</tr>                     
            <tr>
                <td id="label">Comentarios</td>
				<td>
                    <textarea name="memo" cols="40" rows="2"><?php echo $memo?></textarea>
                </td>
				<td id="label"></td>
				<td></td>
	    	</tr>           
            <tr>
                <td id="label">Registro</td>
				<td></td>
				<td id="label">Actualizacion</td>
				<td></td>
	    	</tr>             
            <tr>
                <td></td>
				<td></td>
				<td></td>
				<td>
					<input type="button" value="Guardar" name="aceptar2" onclick="javascript : fn_ArGuardar()"/>				
					<input type="button" id="btn_cancelar"name="btn_cancelar" onclick="javascript: listarArticulos()" value="Cancelar">
				</td>
	    	</tr>
	    </table>
   	</form>
     </div>
  </div>   
</div>           
          
  </div>
</body>
</html>
